/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package no.ffi.gismoidm.attrex;

import java.util.Properties;

/**
 *
 * @author anders
 */
public class IntegerOperand implements NumberOperand {
    private Integer value;
    public IntegerOperand(Integer v) { value = v; }
    public IntegerOperand(String s) { this(Integer.parseInt(s.trim())); }
    @Override
    public Integer getNumberValue() { return value; }
    
    @Override
    public boolean greaterThan(ScalarOperand so, Properties attributes) 
            throws AttributeEvaluationException{
        if (so instanceof IntegerOperand) {
            Integer x = ((IntegerOperand)so).getNumberValue();
            return (value>x);
        } else throw new AttributeEvaluationException("Incompatible types");
    }
    
       public boolean equals(Object o, Properties prop) {
        if (o instanceof IntegerOperand) {
            IntegerOperand io = (IntegerOperand)o;
            return io.value.equals(value);
        }
        return true;
    }
       
    public String toString() { return "#" + value.toString(); }
}
